﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Portal.Logic;
using Portal.Common.Entity;

namespace Portal
{
    public partial class Top : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblUser.Text = "Admin";
                lblDate.Text = DateTime.Today.ToLongDateString() + "   " + "星期" + "日一二三四五六".Substring((int)System.DateTime.Now.DayOfWeek, 1);
                BindData();
            }
        }

        protected void btnLoginOut_Click(object sender, EventArgs e)
        {
            Session["UserDeictionaryList"] = "";
            Page.RegisterClientScriptBlock("out", "<script>window.parent.location.href('login.aspx');</script>");
        }

        public void BindData()
        {
            List<DectionaryEntity> lists = Session["UserDeictionaryList"] as List<DectionaryEntity>;
            List<DectionaryEntity> obj = lists.FindAll(delegate(DectionaryEntity entity)
            {
                if (!string.IsNullOrEmpty(entity.PARENT_DICTIONARY_ID))
                {
                    if (entity.PARENT_DICTIONARY_ID.Trim() == "87" && entity.DICTIONARY_TYPE.Trim().ToUpper() == "MENU")
                    {
                        return true;
                    }
                    return false;
                }
                return false;
            });

            rptSetting.DataSource = obj;
            rptSetting.DataBind();
        }
    }
}